package app.dev.ems.web.wicket.mapper;

import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.component.IRequestablePage;
import org.apache.wicket.request.handler.ListenerInterfaceRequestHandler;
import org.apache.wicket.request.mapper.MountedMapper;
import org.apache.wicket.request.mapper.info.PageComponentInfo;
import org.apache.wicket.request.mapper.parameter.PageParametersEncoder;

public class WithoutPageVersionInfoMountedMapper extends MountedMapper {

	public WithoutPageVersionInfoMountedMapper(String mountPath, Class<? extends IRequestablePage> pageClass) {
		super(mountPath, pageClass, new PageParametersEncoder());
	}

	@Override
	protected void encodePageComponentInfo(Url url, PageComponentInfo info) {

	}

	@Override
	public Url mapHandler(IRequestHandler requestHandler) {
		if (requestHandler instanceof ListenerInterfaceRequestHandler) {
			return null;
		} else {
			return super.mapHandler(requestHandler);
		}
	}
}
